package cn.edu.scau.cmi.chenyuesong.singleton;

import java.util.HashMap;

public class Marshal {
	 private static int index = 0;
	 private static HashMap<String, Marshal> map = new HashMap<>();
	 private Marshal() {
	    }
	 public static Marshal getInstance(String name) {
		 String key = name;
		 Marshal instance = map.get(key);
		 instance = new Marshal();
		 if (index<= 10) {
			 	map.put(key, instance);
			 	index++;
		 }
		 return instance;
	 }
	 
	 public static HashMap<String, Marshal> getMap(){
		 return map;
	 }
	 public static int getIndex() {
		 return index;
	 }
}
